package mylib.archive.y2012.m09.IFMO_Train;

import mylib.dir.FastInputReader;

import java.io.PrintWriter;
import java.util.ArrayList;

public class TaskF {

    int[] st;
    int ptr = 0;
    boolean ok = true;
    int[][] graph = new int[2][2];

    public void solve(int testNumber, FastInputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] ll = new int[n];
        int[] rr = new int[n];
        ArrayList<Integer>[][] g = new ArrayList[2][2];
        for (int i = 0; i < 2; ++i)
            for (int j = 0; j < 2; ++j)
                g[i][j] = new ArrayList<Integer>();
        for (int i = 0; i < n; ++i) {
            int left = getId(in.nextString());
            int right = getId(in.nextString());
            ll[i] = left;
            rr[i] = right;
            g[left][right].add(i);
            graph[left][right]++;
        }


        st = new int[n + 1];

        {
            ok = true;
            int[][] save = clone(graph);
            dfs(0);

            if (graph[1][0] + graph[1][1] > 0)
                dfs(1);
            for (int i = 0, j = n; i < j; ++i, --j) {
                int c = st[i];
                st[i] = st[j];
                st[j] = c;
            }
            int[][] e = new int[2][2];
            ArrayList<Integer> answer = new ArrayList<Integer>();
            for (int i = 1; i <= n; ++i) {
                int a = st[i - 1];
                int b = st[i];
                if (e[a][b] < g[a][b].size()) {
                    answer.add(g[a][b].get(e[a][b]++) + 1);
                } else {
                    ok = false;
                }
            }
            if (ok) {
                out.print("YES\n");
                for (int x : answer)
                    out.print(x + " ");
                return;
            }
            graph = clone(save);
        }

        {
            ok = true;
            ptr = 0;
            dfs(1);
            int[][] save = clone(graph);
            if (graph[0][0] + graph[0][1] > 0)
                dfs(0);
            for (int i = 0, j = n; i < j; ++i, --j) {
                int c = st[i];
                st[i] = st[j];
                st[j] = c;
            }
            int[][] e = new int[2][2];
            ArrayList<Integer> answer = new ArrayList<Integer>();
            for (int i = 1; i <= n; ++i) {
                int a = st[i - 1];
                int b = st[i];
                if (e[a][b] < g[a][b].size()) {
                    answer.add(g[a][b].get(e[a][b]++) + 1);
                } else {
                    ok = false;
                }
            }
            if (ok) {
                out.print("YES\n");
                for (int x : answer)
                    out.print(x + " ");
                return;
            }
            graph = clone(save);
        }
        out.print("NO");


    }

    private int[][] clone(int[][] graph) {
        int[][] a = new int[graph.length][graph[0].length];
        for (int i = 0; i < a.length; ++i)
            a[i] = graph[i].clone();
        return a;
    }

    private void dfs(int v) {
        for (int to = 0; to < 2; ++to) {
            if (graph[v][to] > 0) {
                graph[v][to]--;
                dfs(to);
            }
        }
        if (ptr < st.length)
            st[ptr++] = v;
        else ok = false;
    }

    class Edge implements Comparable<Edge> {
        int to;
        int Id;
        boolean valid;

        Edge(int to, int id, boolean valid) {
            this.to = to;
            Id = id;
            this.valid = valid;
        }

        @Override
        public int compareTo(Edge o) {
            return 0;
        }
    }

    int getId(String s) {
        return s.equals("USB") ? 0 : 1;
    }
}
